

{% extends "bootstrap/base.html" %}
{% block title %}
    添加状态
{% endblock %}
{% include 'nav.html' %}
{% block content %}
<body background="{{ url_for('static', filename='images/background.jpg') }}">
<div class="container login-page" style="padding-top: 20px">
    <div class="row">
        <div class="col-md-4 col-lg-offset-4">
            {% for category, message in get_flashed_messages(with_categories=true) %}
                <div class="alert alert-{{ category }} alert-dismissable">
                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                    {{ message }}
                </div>
            {% endfor %}
            <h3 class="text-center">状态管理</h3>
            <form class="form-horizontal" role="form" method="post" action="">
                {{ form.hidden_tag() }}
                <div class="form-group">
                    {{ form.name.label(class='col-sm-3 control-label') }}
                    <div class="col-sm-9">
                        <div class="input-group">
                            {{ form.name(class='form-control', placeholder='状态名称', required='') }}
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-3 col-sm-9">
                        <button type="submit" class="btn btn-default">添加状态</button>
                    </div>
                </div>
            </form>
            <table class="table table-hover">
              <thead>
                <tr>
                  <th>ID</th>
                  <th>名称</th>
                  <th>编辑</th>
                  <th>删除</th>
                </tr>
              </thead>
              <tbody>
              {% for status in statuses %}
                <tr>
                  <td>{{ status.id }}</td>
                  <td>{{ status.name }}</td>
                  <td>
                      <a href="{{ url_for('admin.edit_status',id=status.id) }}">编辑</a>
                  </td>
                  <td>
                      <a href="{{ url_for('admin.delete_status',id=status.id) }}">删除</a>
                  </td>
                </tr>
              {% endfor %}
              </tbody>
            </table>
        </div>
    </div>
</div>
</body>
{% endblock %}
